<?php
class ProductsController extends AppController {
	public $components = array('RequestHandler');

	public function index() {
		$this->layout = null;
		$this->Product->recursive = 3;
		$products = $this->Product->find('all');
		$this->set(array(
            'products' => $products,
            '_serialize' => array('products')
        ));
	}

	public function view($id){
		$this->layout = null;
		$this->Product->recursive = 3;
		$product = $this->Product->find('all', array('conditions' => array('Product.id' => $id)));
		$this->set(array(
			'product' => $product,
			'_serialize' => array('product')
		));
	}
}
